package com.office.workflow.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.office.common.annotation.Excel;
import com.office.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.Date;

/**
 * 工作流执行实例对象 workflow_instance
 * 
 * @author 数字牧马人
 */
public class WorkflowInstance extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 实例ID */
    private Long id;

    /** 工作流ID */
    private Long workflowId;

    /** 实例唯一标识 */
    @Excel(name = "实例标识")
    private String instanceId;

    /** 实例名称 */
    @Excel(name = "实例名称")
    private String name;

    /** 状态(0:运行中,1:已完成,2:失败,3:已取消) */
    @Excel(name = "状态", readConverterExp = "0=运行中,1=已完成,2=失败,3=已取消")
    private String status;

    /** 输入参数(JSON格式) */
    private String inputParams;

    /** 输出结果(JSON格式) */
    private String outputResult;

    /** 错误信息 */
    private String errorMessage;

    /** 开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;

    /** 结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "结束时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;

    /** 执行时长(毫秒) */
    @Excel(name = "执行时长(毫秒)")
    private Long duration;

    /** 工作流名称 */
    private String workflowName;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setWorkflowId(Long workflowId) 
    {
        this.workflowId = workflowId;
    }

    public Long getWorkflowId() 
    {
        return workflowId;
    }

    public void setInstanceId(String instanceId) 
    {
        this.instanceId = instanceId;
    }

    public String getInstanceId() 
    {
        return instanceId;
    }

    public void setName(String name) 
    {
        this.name = name;
    }

    public String getName() 
    {
        return name;
    }

    public void setStatus(String status) 
    {
        this.status = status;
    }

    public String getStatus() 
    {
        return status;
    }

    public void setInputParams(String inputParams) 
    {
        this.inputParams = inputParams;
    }

    public String getInputParams() 
    {
        return inputParams;
    }

    public void setOutputResult(String outputResult) 
    {
        this.outputResult = outputResult;
    }

    public String getOutputResult() 
    {
        return outputResult;
    }

    public void setErrorMessage(String errorMessage) 
    {
        this.errorMessage = errorMessage;
    }

    public String getErrorMessage() 
    {
        return errorMessage;
    }

    public void setStartTime(Date startTime) 
    {
        this.startTime = startTime;
    }

    public Date getStartTime() 
    {
        return startTime;
    }

    public void setEndTime(Date endTime) 
    {
        this.endTime = endTime;
    }

    public Date getEndTime() 
    {
        return endTime;
    }

    public void setDuration(Long duration) 
    {
        this.duration = duration;
    }

    public Long getDuration() 
    {
        return duration;
    }

    public void setWorkflowName(String workflowName) 
    {
        this.workflowName = workflowName;
    }

    public String getWorkflowName() 
    {
        return workflowName;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("workflowId", getWorkflowId())
            .append("instanceId", getInstanceId())
            .append("name", getName())
            .append("status", getStatus())
            .append("inputParams", getInputParams())
            .append("outputResult", getOutputResult())
            .append("errorMessage", getErrorMessage())
            .append("startTime", getStartTime())
            .append("endTime", getEndTime())
            .append("duration", getDuration())
            .append("createBy", getCreateBy())
            .append("createTime", getCreateTime())
            .append("updateTime", getUpdateTime())
            .toString();
    }
} 